/* Written 8/12/93 by Max Hailperin <max@nic.gac.edu>, Math/CS department,
   Gustavus Adolphus College.  Public domain, no warranty.  Please share
   any improvements with me.  */

#import <syslog.h>
#import <stdio.h>
#import <stdlib.h>
#import "daemon.h"
#import "GACUPSListener.h"
#import "UPSController.h"

void main(int argc, char *argv[]) {
  id listener;

  if(argc != 2){
    fprintf(stderr, "Usage: %s tty\n", argv[0]);
    exit(1);
  }
  openlog("GACUPS.daemon", LOG_CONS, FACILITY);
  listener = [[GACUPSListener alloc] init];
  [listener setDelegate:[[UPSController alloc] initOn:argv[1]]];
  [listener checkInAs:"GACUPS.daemon"];
  [listener addPort];
  [GACUPSListener run];
}
